﻿using ProjectCore.Common;
using ProjectCore.Domain.DomainService;
using ProjectCore.Domain.Model.Entity;
using ProjectCore.Domain.Repository.Interfaces;
using ProjectCore.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace ProjectCore.Application
{
    public class AppProductType : IAppProductType
    {
        private readonly IBaseRepository<ProductType> baseRepository;
        private readonly MyContext myContext;
        private readonly IProductTypeDomainService productType1;
        public AppProductType(IBaseRepository<ProductType> _baseRepository, MyContext _myContext, IProductTypeDomainService _productDomainService)
        {
            baseRepository = _baseRepository;
            myContext = _myContext;
            productType1 = _productDomainService;
        }

        //反填
        public async Task<ProductType> GetProductType(int Id)
        {
            return await productType1.GetProductType(Id);
        }


        //获取商品分类集合
        public async Task<HeaderResult<List<ProductType>>> GetProductTypes(int pageIndex, int pageSize)
        {
            return await productType1.GetProductTypes(pageIndex,pageSize);
        }


        //逻辑删除
        public async Task<int> IsDel(int Id)
        {
            return await productType1.IsDel(Id);
        }


        //修改
        public async Task<int> UptProductType(ProductType productType)
        {
            return await productType1.UptProductType(productType);
        }
    }
}
